home *** CD-ROM | disk | FTP | other *** search
/ Champak 26 (Anniversary Edition) / Volume 26 [Anniversary Edition] - JOGO DISK .iso / Fight / battleinmegaville.swf / scripts / frame_2013 / DoAction.as
Text File  |  2006-09-05  |  79KB  |  2,314 lines

  1. §§pop();
  2. §§pop();
  3. spriteIndex = 0;
  4. while(spriteIndex < _spriteInstances)
  5. {
  6.    if(_gameover && sprite[spriteIndex]._state != STATE_COMBO1 && sprite[spriteIndex]._state != STATE_COMBO2 || _gameMode == MODE_TUTORIAL && spriteIndex == 1)
  7.    {
  8.       onLeft = false;
  9.       onRight = false;
  10.       onUp = false;
  11.       onDown = false;
  12.       onA = false;
  13.       onB = false;
  14.       newLeft = false;
  15.       newRight = false;
  16.       newUp = false;
  17.       newDown = false;
  18.       newA = false;
  19.       newB = false;
  20.       keyCombo[spriteIndex] = null;
  21.    }
  22.    if(_numPlayers > 1 && !sprite[1]._deflect && (sprite[1]._state == STATE_IDLE || sprite[1]._state == STATE_RUN))
  23.    {
  24.       sprite[1]._deflect = !keyWasDown[1][KEYINDEX_B] && Key.isDown(keyCode[1][KEYINDEX_B]);
  25.       if(sprite[1]._deflect)
  26.       {
  27.          sprite[1]._deflectwait = true;
  28.       }
  29.    }
  30.    if(spriteIndex < _numPlayers && (!_gameover || sprite[spriteIndex]._state == STATE_COMBO1 || sprite[spriteIndex]._state == STATE_COMBO2))
  31.    {
  32.       k = 0;
  33.       while(k < KEYSPERPLAYER)
  34.       {
  35.          if(!keyWasDown[spriteIndex][k] && Key.isDown(keyCode[spriteIndex][k]))
  36.          {
  37.             updateKeyCombo(spriteIndex,k);
  38.          }
  39.          else if(_numPlayers == 1 && _singlePlayerDualControlsEnabled && !keyWasDown[spriteIndex][k] && Key.isDown(keyCode[spriteIndex + 1][k]))
  40.          {
  41.             updateKeyCombo(spriteIndex,k);
  42.          }
  43.          k++;
  44.       }
  45.       updateKeyCombo(spriteIndex,null);
  46.       onLeft = Key.isDown(keyCode[spriteIndex][KEYINDEX_LEFT]);
  47.       onRight = Key.isDown(keyCode[spriteIndex][KEYINDEX_RIGHT]);
  48.       onUp = Key.isDown(keyCode[spriteIndex][KEYINDEX_UP]);
  49.       onDown = Key.isDown(keyCode[spriteIndex][KEYINDEX_DOWN]);
  50.       onA = Key.isDown(keyCode[spriteIndex][KEYINDEX_A]);
  51.       onB = Key.isDown(keyCode[spriteIndex][KEYINDEX_B]);
  52.       if(_numPlayers == 1 && _singlePlayerDualControlsEnabled)
  53.       {
  54.          onLeft = onLeft || Key.isDown(keyCode[1][KEYINDEX_LEFT]);
  55.          onRight = onRight || Key.isDown(keyCode[1][KEYINDEX_RIGHT]);
  56.          onUp = onUp || Key.isDown(keyCode[1][KEYINDEX_UP]);
  57.          onDown = onDown || Key.isDown(keyCode[1][KEYINDEX_DOWN]);
  58.          onA = onA || Key.isDown(keyCode[1][KEYINDEX_A]);
  59.          onB = onB || Key.isDown(keyCode[1][KEYINDEX_B]);
  60.       }
  61.       newLeft = !keyWasDown[spriteIndex][KEYINDEX_LEFT] && onLeft;
  62.       newRight = !keyWasDown[spriteIndex][KEYINDEX_RIGHT] && onRight;
  63.       newUp = !keyWasDown[spriteIndex][KEYINDEX_UP] && onUp;
  64.       newDown = !keyWasDown[spriteIndex][KEYINDEX_DOWN] && onDown;
  65.       newA = !keyWasDown[spriteIndex][KEYINDEX_A] && onA;
  66.       newB = !keyWasDown[spriteIndex][KEYINDEX_B] && onB;
  67.       keyWasDown[spriteIndex][KEYINDEX_LEFT] = onLeft;
  68.       keyWasDown[spriteIndex][KEYINDEX_RIGHT] = onRight;
  69.       keyWasDown[spriteIndex][KEYINDEX_UP] = onUp;
  70.       keyWasDown[spriteIndex][KEYINDEX_DOWN] = onDown;
  71.       keyWasDown[spriteIndex][KEYINDEX_A] = onA;
  72.       keyWasDown[spriteIndex][KEYINDEX_B] = onB;
  73.       keyWasDown[spriteIndex][KEYINDEX_L] = onL;
  74.       keyWasDown[spriteIndex][KEYINDEX_R] = onR;
  75.       if(spriteIndex == 0)
  76.       {
  77.          if(!sprite[spriteIndex]._deflect && (sprite[spriteIndex]._state == STATE_IDLE || sprite[spriteIndex]._state == STATE_RUN))
  78.          {
  79.             sprite[spriteIndex]._deflect = newB;
  80.             if(sprite[spriteIndex]._deflect)
  81.             {
  82.                sprite[spriteIndex]._deflectwait = true;
  83.             }
  84.          }
  85.       }
  86.    }
  87.    thisSprite = sprite[spriteIndex];
  88.    thisName = spriteName[spriteIndex];
  89.    faceLeft = thisSprite._xscale > 0;
  90.    ai = spriteIndex >= _numPlayers && _gameMode != MODE_TUTORIAL;
  91.    otherai = (_numPlayers == 0 || _numPlayers == 1 && spriteIndex == 0) && _gameMode != MODE_TUTORIAL;
  92.    otherSprite = sprite[1 - spriteIndex];
  93.    otherIndex = 1 - spriteIndex;
  94.    otherName = spriteName[1 - spriteIndex];
  95.    aiRun();
  96.    if(!onDown && thisSprite._state == STATE_SHIELD)
  97.    {
  98.       thisSprite._state = STATE_IDLE;
  99.       if(!thisSprite._airborne)
  100.       {
  101.          thisSprite.gotoAndPlay("idle");
  102.       }
  103.       else
  104.       {
  105.          thisSprite.gotoAndPlay("fall");
  106.       }
  107.    }
  108.    else if(thisSprite._state == STATE_COMBO1)
  109.    {
  110.       if(thisSprite._stateDone)
  111.       {
  112.          bufferedCombo2[spriteIndex] = false;
  113.          bufferedCombo3[spriteIndex] = false;
  114.          thisSprite._state = STATE_IDLE;
  115.          thisSprite._stateDone = false;
  116.          thisSprite._comboDone = false;
  117.          thisSprite._weakHit = false;
  118.       }
  119.       else if(thisSprite._comboDone)
  120.       {
  121.          if(bufferedCombo2[spriteIndex] == KEYINDEX_A)
  122.          {
  123.             bufferedCombo2[spriteIndex] = false;
  124.             thisSprite._state = STATE_COMBO2B;
  125.             thisSprite._stateDone = false;
  126.             thisSprite._comboDone = false;
  127.             thisSprite._weakHit = false;
  128.             thisSprite.gotoAndPlay("upper");
  129.             thisSprite._ai_aerial = 0;
  130.             damageDone[spriteIndex][otherIndex] = false;
  131.             if(thisName == NAME_BLOSSOM)
  132.             {
  133.                if(faceLeft)
  134.                {
  135.                   thisSprite._atkdirX = ATKDIR_LEFT;
  136.                }
  137.                else
  138.                {
  139.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  140.                }
  141.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  142.                thisSprite._damage = 6;
  143.             }
  144.             else if(thisName == NAME_BUBBLES)
  145.             {
  146.                if(faceLeft)
  147.                {
  148.                   thisSprite._atkdirX = ATKDIR_LEFT;
  149.                }
  150.                else
  151.                {
  152.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  153.                }
  154.                thisSprite._atkdirY = ATKDIR_UP;
  155.                thisSprite._damage = 8;
  156.             }
  157.             else if(thisName == NAME_BUTTERCUP)
  158.             {
  159.                if(faceLeft)
  160.                {
  161.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  162.                }
  163.                else
  164.                {
  165.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  166.                }
  167.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  168.                thisSprite._damage = 6;
  169.             }
  170.             else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  171.             {
  172.                thisSprite._atkdirX = ATKDIR_VACUUM;
  173.                thisSprite._atkdirY = ATKDIR_NONE;
  174.                thisSprite._damage = 2;
  175.             }
  176.             else if(thisName == NAME_DEXTER)
  177.             {
  178.                if(faceLeft)
  179.                {
  180.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  181.                }
  182.                else
  183.                {
  184.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  185.                }
  186.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  187.                thisSprite._damage = 10;
  188.             }
  189.             else if(thisName == NAME_ROWDY)
  190.             {
  191.                if(faceLeft)
  192.                {
  193.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  194.                }
  195.                else
  196.                {
  197.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  198.                }
  199.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  200.                thisSprite._damage = 5;
  201.             }
  202.          }
  203.          else if(bufferedCombo2[spriteIndex] == KEYINDEX_B)
  204.          {
  205.             bufferedCombo2[spriteIndex] = false;
  206.             thisSprite._state = STATE_COMBO2;
  207.             thisSprite._stateDone = false;
  208.             thisSprite._comboDone = false;
  209.             thisSprite._weakHit = false;
  210.             thisSprite.gotoAndPlay("combo2");
  211.             damageDone[spriteIndex][otherIndex] = false;
  212.             if(faceLeft)
  213.             {
  214.                thisSprite._atkdirX = ATKDIR_NONELEFT;
  215.             }
  216.             else
  217.             {
  218.                thisSprite._atkdirX = ATKDIR_NONERIGHT;
  219.             }
  220.             thisSprite._atkdirY = ATKDIR_NONE;
  221.             if(thisName == NAME_BUTTERCUP)
  222.             {
  223.                thisSprite._atkdirY = ATKDIR_UP;
  224.             }
  225.             thisSprite._damage = 2;
  226.             if(thisName == NAME_DEXTER)
  227.             {
  228.                thisSprite._damage = 3;
  229.             }
  230.          }
  231.       }
  232.    }
  233.    else if(thisSprite._state == STATE_COMBO2)
  234.    {
  235.       if(thisSprite._stateDone)
  236.       {
  237.          bufferedCombo3[spriteIndex] = false;
  238.          thisSprite._state = STATE_IDLE;
  239.          thisSprite._stateDone = false;
  240.          thisSprite._comboDone = false;
  241.          thisSprite._weakHit = false;
  242.       }
  243.       else if(thisSprite._comboDone)
  244.       {
  245.          if(bufferedCombo3[spriteIndex] == KEYINDEX_A)
  246.          {
  247.             bufferedCombo3[spriteIndex] = false;
  248.             thisSprite._state = STATE_COMBO3B;
  249.             thisSprite._stateDone = false;
  250.             thisSprite._comboDone = false;
  251.             thisSprite._weakHit = false;
  252.             thisSprite.gotoAndPlay("combo3u");
  253.             damageDone[spriteIndex][otherIndex] = false;
  254.             if(thisName == NAME_BLOSSOM)
  255.             {
  256.                if(faceLeft)
  257.                {
  258.                   thisSprite._atkdirX = ATKDIR_LEFT;
  259.                }
  260.                else
  261.                {
  262.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  263.                }
  264.                thisSprite._atkdirY = ATKDIR_UP;
  265.                thisSprite._damage = 10;
  266.             }
  267.             else if(thisName == NAME_BUBBLES)
  268.             {
  269.                if(faceLeft)
  270.                {
  271.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  272.                }
  273.                else
  274.                {
  275.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  276.                }
  277.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  278.                thisSprite._damage = 5;
  279.             }
  280.             else if(thisName == NAME_BUTTERCUP)
  281.             {
  282.                if(faceLeft)
  283.                {
  284.                   thisSprite._atkdirX = ATKDIR_LEFT;
  285.                }
  286.                else
  287.                {
  288.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  289.                }
  290.                thisSprite._atkdirY = ATKDIR_DOWN;
  291.                thisSprite._damage = 7;
  292.             }
  293.             else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  294.             {
  295.                if(faceLeft)
  296.                {
  297.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  298.                }
  299.                else
  300.                {
  301.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  302.                }
  303.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  304.                thisSprite._damage = 6;
  305.             }
  306.             else if(thisName == NAME_DEXTER)
  307.             {
  308.                if(faceLeft)
  309.                {
  310.                   thisSprite._atkdirX = ATKDIR_LEFT;
  311.                }
  312.                else
  313.                {
  314.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  315.                }
  316.                thisSprite._atkdirY = ATKDIR_UP;
  317.                thisSprite._damage = 14;
  318.             }
  319.             else if(thisName == NAME_ROWDY)
  320.             {
  321.                if(faceLeft)
  322.                {
  323.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  324.                }
  325.                else
  326.                {
  327.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  328.                }
  329.                thisSprite._atkdirY = ATKDIR_NONE;
  330.                thisSprite._damage = 1;
  331.             }
  332.          }
  333.          else if(bufferedCombo3[spriteIndex] == KEYINDEX_B)
  334.          {
  335.             bufferedCombo3[spriteIndex] = false;
  336.             thisSprite._state = STATE_COMBO3;
  337.             thisSprite._stateDone = false;
  338.             thisSprite._comboDone = false;
  339.             thisSprite._weakHit = false;
  340.             thisSprite.gotoAndPlay("combo3");
  341.             if(thisSprite._yspd < -5)
  342.             {
  343.                thisSprite._yspd = -5;
  344.             }
  345.             damageDone[spriteIndex][otherIndex] = false;
  346.             if(thisName == NAME_BLOSSOM)
  347.             {
  348.                if(faceLeft)
  349.                {
  350.                   thisSprite._atkdirX = ATKDIR_LEFT;
  351.                }
  352.                else
  353.                {
  354.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  355.                }
  356.                thisSprite._atkdirY = ATKDIR_NONE;
  357.                thisSprite._damage = 7;
  358.             }
  359.             else if(thisName == NAME_BUBBLES)
  360.             {
  361.                if(faceLeft)
  362.                {
  363.                   thisSprite._atkdirX = ATKDIR_LEFT;
  364.                }
  365.                else
  366.                {
  367.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  368.                }
  369.                thisSprite._atkdirY = ATKDIR_UP;
  370.                thisSprite._damage = 12;
  371.             }
  372.             else if(thisName == NAME_BUTTERCUP)
  373.             {
  374.                if(faceLeft)
  375.                {
  376.                   thisSprite._atkdirX = ATKDIR_LEFT;
  377.                }
  378.                else
  379.                {
  380.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  381.                }
  382.                thisSprite._atkdirY = ATKDIR_BOUNCE;
  383.                thisSprite._damage = 8;
  384.                tempyspd = -50;
  385.                thisSprite._airborne = true;
  386.             }
  387.             else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  388.             {
  389.                if(faceLeft)
  390.                {
  391.                   thisSprite._atkdirX = ATKDIR_LEFT;
  392.                }
  393.                else
  394.                {
  395.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  396.                }
  397.                thisSprite._atkdirY = ATKDIR_UP;
  398.                thisSprite._damage = 4;
  399.             }
  400.             else if(thisName == NAME_DEXTER)
  401.             {
  402.                if(faceLeft)
  403.                {
  404.                   thisSprite._atkdirX = ATKDIR_NONELEFT;
  405.                }
  406.                else
  407.                {
  408.                   thisSprite._atkdirX = ATKDIR_NONERIGHT;
  409.                }
  410.                thisSprite._atkdirY = ATKDIR_NONE;
  411.                thisSprite._damage = 24;
  412.             }
  413.             else if(thisName == NAME_ROWDY)
  414.             {
  415.                if(faceLeft)
  416.                {
  417.                   thisSprite._atkdirX = ATKDIR_LEFT;
  418.                }
  419.                else
  420.                {
  421.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  422.                }
  423.                thisSprite._atkdirY = ATKDIR_NONE;
  424.                thisSprite._damage = 12;
  425.             }
  426.          }
  427.       }
  428.    }
  429.    else if(thisSprite._state == STATE_COMBO2B)
  430.    {
  431.       if(thisSprite._stateDone)
  432.       {
  433.          thisSprite._state = STATE_IDLE;
  434.          thisSprite._stateDone = false;
  435.          thisSprite._comboDone = false;
  436.          thisSprite._weakHit = false;
  437.       }
  438.    }
  439.    else if(thisSprite._state == STATE_COMBO3)
  440.    {
  441.       if(thisSprite._stateDone)
  442.       {
  443.          thisSprite._state = STATE_IDLE;
  444.          thisSprite._stateDone = false;
  445.          thisSprite._comboDone = false;
  446.          thisSprite._weakHit = false;
  447.       }
  448.    }
  449.    else if(thisSprite._state == STATE_COMBO3B)
  450.    {
  451.       if(thisSprite._stateDone)
  452.       {
  453.          thisSprite._state = STATE_IDLE;
  454.          thisSprite._stateDone = false;
  455.          thisSprite._comboDone = false;
  456.          thisSprite._weakHit = false;
  457.       }
  458.    }
  459.    else if(thisSprite._state == STATE_RANGED)
  460.    {
  461.       if(thisSprite._hitDone)
  462.       {
  463.          if(thisName == NAME_BUBBLES)
  464.          {
  465.             thisSprite._hitDone = false;
  466.             if(faceLeft)
  467.             {
  468.                thisSprite.projectile._x = thisSprite._x - 20;
  469.                thisSprite.projectile._xscale = 100;
  470.             }
  471.             else
  472.             {
  473.                thisSprite.projectile._x = thisSprite._x + 20;
  474.                thisSprite.projectile._xscale = -100;
  475.             }
  476.             thisSprite.projectile._yspd = 0;
  477.             thisSprite.projectile._y = thisSprite._y;
  478.             thisSprite.projectile._visible = true;
  479.             thisSprite.projectile._hitDone = false;
  480.          }
  481.          else if(thisName == NAME_ROWDY)
  482.          {
  483.             thisSprite._hitDone = false;
  484.             if(faceLeft)
  485.             {
  486.                thisSprite.projectile._x = thisSprite._x + 140;
  487.                thisSprite.projectile._xscale = 100;
  488.             }
  489.             else
  490.             {
  491.                thisSprite.projectile._x = thisSprite._x - 140;
  492.                thisSprite.projectile._xscale = -100;
  493.             }
  494.             thisSprite.projectile._y = 204 + terrain._y + 245;
  495.             thisSprite.projectile._visible = true;
  496.             thisSprite.projectile._hitDone = false;
  497.             thisSprite.projectile.gotoAndPlay("boomer");
  498.          }
  499.       }
  500.       if(thisSprite._stateDone)
  501.       {
  502.          thisSprite._state = STATE_IDLE;
  503.          thisSprite._stateDone = false;
  504.          thisSprite._weakHit = false;
  505.       }
  506.    }
  507.    else if(thisSprite._state == STATE_AIRRANGED2)
  508.    {
  509.       if(thisSprite._stateDone)
  510.       {
  511.          thisSprite._state = STATE_IDLE;
  512.          thisSprite._stateDone = false;
  513.          thisSprite.gotoAndPlay("idle");
  514.          thisSprite._weakHit = false;
  515.       }
  516.    }
  517.    else if(thisSprite._state == STATE_AIRRANGED)
  518.    {
  519.       if(thisSprite._hitDone)
  520.       {
  521.          if(thisName == NAME_DEXTER)
  522.          {
  523.             thisSprite._hitDone = false;
  524.             thisSprite._state = STATE_AIRRANGED2;
  525.          }
  526.          else if(thisName == NAME_BUBBLES)
  527.          {
  528.             thisSprite._hitDone = false;
  529.             if(faceLeft)
  530.             {
  531.                thisSprite.projectile._x = thisSprite._x - 20;
  532.                thisSprite.projectile._xscale = 100;
  533.             }
  534.             else
  535.             {
  536.                thisSprite.projectile._x = thisSprite._x + 20;
  537.                thisSprite.projectile._xscale = -100;
  538.             }
  539.             thisSprite.projectile._yspd = 5;
  540.             thisSprite.projectile._y = thisSprite._y;
  541.             thisSprite.projectile._visible = true;
  542.             thisSprite.projectile._hitDone = false;
  543.             if(thisSprite.projectile._fast)
  544.             {
  545.                thisSprite.projectile._yspd *= 2;
  546.             }
  547.          }
  548.          else if(thisName == NAME_ROWDY)
  549.          {
  550.             thisSprite._hitDone = false;
  551.             thisSprite.projectile._x = thisSprite._x;
  552.             if(faceLeft)
  553.             {
  554.                thisSprite.projectile._xscale = 100;
  555.             }
  556.             else
  557.             {
  558.                thisSprite.projectile._xscale = -100;
  559.             }
  560.             thisSprite.projectile._y = 200 + terrain._y + 245;
  561.             thisSprite.projectile._visible = true;
  562.             thisSprite.projectile._hitDone = false;
  563.             thisSprite.projectile.gotoAndPlay("butch");
  564.          }
  565.       }
  566.       if(thisSprite._stateDone)
  567.       {
  568.          thisSprite._state = STATE_IDLE;
  569.          thisSprite._stateDone = false;
  570.          if(!thisSprite._airborne)
  571.          {
  572.             thisSprite.gotoAndPlay("idle");
  573.          }
  574.          thisSprite._weakHit = false;
  575.       }
  576.       else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  577.       {
  578.          if(!thisSprite._airborne)
  579.          {
  580.             thisSprite._state = STATE_AIRRANGED2;
  581.             thisSprite.gotoAndPlay("land");
  582.          }
  583.       }
  584.    }
  585.    else if(thisSprite._state == STATE_DOWNATK)
  586.    {
  587.       if(thisSprite._stateDone)
  588.       {
  589.          thisSprite._state = STATE_IDLE;
  590.          thisSprite._stateDone = false;
  591.          if(!thisSprite._airborne)
  592.          {
  593.             thisSprite.gotoAndPlay("idle");
  594.          }
  595.          thisSprite._weakHit = false;
  596.       }
  597.    }
  598.    else if(thisSprite._state == STATE_RECOVER)
  599.    {
  600.       if(thisSprite._stateDone)
  601.       {
  602.          thisSprite._state = STATE_IDLE;
  603.          thisSprite._stateDone = false;
  604.       }
  605.    }
  606.    else if(thisSprite._state == STATE_FROZEN)
  607.    {
  608.       if(thisSprite._stateDone)
  609.       {
  610.          thisSprite._state = STATE_IDLE;
  611.          thisSprite._stateDone = false;
  612.          sprite[0].combo.num = 0;
  613.          sprite[1].combo.num = 0;
  614.       }
  615.    }
  616.    if(thisSprite._state == STATE_FALLEN && thisSprite._fallTime-- <= 0 && thisSprite._hp > MIN_HP)
  617.    {
  618.       bufferedUp[spriteIndex] = false;
  619.       bufferedLeft[spriteIndex] = false;
  620.       bufferedRight[spriteIndex] = false;
  621.       thisSprite.gotoAndPlay("recover");
  622.       thisSprite._stateDone = false;
  623.       thisSprite._state = STATE_RECOVER;
  624.       thisSprite._juggles = 0;
  625.       sprite[0].combo.num = 0;
  626.       sprite[1].combo.num = 0;
  627.    }
  628.    else if((keyCombo[spriteIndex] == KEYINDEX_LEFT && newLeft || keyCombo[spriteIndex] == KEYINDEX_RIGHT && newRight) && !thisSprite._dashed && thisSprite._dashes >= 100 && thisName != NAME_ZIM && (thisName != NAME_DEXTER || !thisSprite._airborne) && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE || thisSprite._state == STATE_SHIELD || thisSprite._state == STATE_SHIELDDAMAGE || thisSprite._state == STATE_RECOVER))
  629.    {
  630.       thisSprite._state = STATE_DASH;
  631.       sprite[spriteIndex]._invincible = true;
  632.       thisSprite._dashFuel = SPRITE_MAXDASHFUEL[spriteIndex];
  633.       thisSprite.gotoAndPlay("dash");
  634.       thisSprite._dashed = true;
  635.       thisSprite._dashes -= 100;
  636.       if(keyCombo[spriteIndex] == KEYINDEX_LEFT && !faceLeft || keyCombo[spriteIndex] == KEYINDEX_RIGHT && faceLeft)
  637.       {
  638.          thisSprite._xscale *= -1;
  639.          faceLeft = !faceLeft;
  640.       }
  641.       clearKeyCombo(spriteIndex);
  642.    }
  643.    else if(onDown && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE))
  644.    {
  645.       thisSprite._state = STATE_SHIELD;
  646.       thisSprite.gotoAndPlay("shield");
  647.       if(thisSprite._yspd < -5)
  648.       {
  649.          thisSprite._yspd = -5;
  650.       }
  651.    }
  652.    else if((newA || newB) && (thisSprite._state == STATE_RUN || thisSprite._state == STATE_IDLE))
  653.    {
  654.       if(thisSprite._airborne)
  655.       {
  656.          if(newA)
  657.          {
  658.             if((thisName == NAME_BUBBLES || thisName == NAME_ROWDY) && !thisSprite.projectile._visible && !thisSprite._hovered || thisName == NAME_BUTTERCUP && !thisSprite._hovered || thisName == NAME_BLOSSOM || thisName == NAME_DEXTER || thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  659.             {
  660.                if(thisName == NAME_BUTTERCUP)
  661.                {
  662.                   thisSprite._hovered = true;
  663.                }
  664.                thisSprite._state = STATE_AIRRANGED;
  665.                thisSprite._stateDone = false;
  666.                if(thisName == NAME_DEXTER)
  667.                {
  668.                   thisSprite.gotoAndPlay("combo3");
  669.                }
  670.                else if(thisName == NAME_ROWDY)
  671.                {
  672.                   thisSprite.gotoAndPlay("ranged");
  673.                }
  674.                else
  675.                {
  676.                   thisSprite.gotoAndPlay("airranged");
  677.                }
  678.                if(thisSprite._yspd < 0)
  679.                {
  680.                   thisSprite._yspd = 0;
  681.                }
  682.                damageDone[spriteIndex][otherIndex] = false;
  683.                thisSprite.projectile._fast = onLeft || onRight;
  684.                if(onLeft && !faceLeft || onRight && faceLeft)
  685.                {
  686.                   thisSprite._xscale *= -1;
  687.                   faceLeft = !faceLeft;
  688.                }
  689.                if(faceLeft)
  690.                {
  691.                   thisSprite._atkdirX = ATKDIR_LEFT;
  692.                }
  693.                else
  694.                {
  695.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  696.                }
  697.                thisSprite._atkdirY = ATKDIR_NONE;
  698.                if(thisName == NAME_BLOSSOM)
  699.                {
  700.                   thisSprite._damage = 5;
  701.                }
  702.                else if(thisName == NAME_BUBBLES)
  703.                {
  704.                   thisSprite._damage = 0;
  705.                   thisSprite.projectile._damage = 3;
  706.                   thisSprite._hovered = true;
  707.                }
  708.                else if(thisName == NAME_ROWDY)
  709.                {
  710.                   thisSprite._damage = 0;
  711.                   thisSprite.projectile._damage = BUTCH_DAMAGE;
  712.                   thisSprite._hovered = true;
  713.                }
  714.                else if(thisName == NAME_BUTTERCUP)
  715.                {
  716.                   thisSprite._damage = 7;
  717.                }
  718.                else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  719.                {
  720.                   thisSprite._atkdirY = ATKDIR_UP;
  721.                   thisSprite._damage = 10;
  722.                   thisSprite._dashFuel = 5;
  723.                }
  724.                else if(thisName == NAME_DEXTER)
  725.                {
  726.                   thisSprite._atkdirY = ATKDIR_DOWN;
  727.                   thisSprite._damage = 12;
  728.                }
  729.             }
  730.          }
  731.          else if(!thisSprite._hovered)
  732.          {
  733.             thisSprite._hovered = true;
  734.             thisSprite._state = STATE_DOWNATK;
  735.             thisSprite._stateDone = false;
  736.             thisSprite.gotoAndPlay("downatk");
  737.             if(thisSprite._yspd < 0)
  738.             {
  739.                thisSprite._yspd = 0;
  740.             }
  741.             damageDone[spriteIndex][otherIndex] = false;
  742.             if(onLeft && !faceLeft || onRight && faceLeft)
  743.             {
  744.                thisSprite._xscale *= -1;
  745.                faceLeft = !faceLeft;
  746.             }
  747.             if(faceLeft)
  748.             {
  749.                thisSprite._atkdirX = ATKDIR_LEFT;
  750.             }
  751.             else
  752.             {
  753.                thisSprite._atkdirX = ATKDIR_RIGHT;
  754.             }
  755.             thisSprite._atkdirY = ATKDIR_NONE;
  756.             thisSprite._damage = 7;
  757.             if(thisName == NAME_DEXTER)
  758.             {
  759.                thisSprite._damage = 8;
  760.             }
  761.          }
  762.       }
  763.       else if(newA)
  764.       {
  765.          if(thisName != NAME_BUBBLES && thisName != NAME_ROWDY || !thisSprite.projectile._visible)
  766.          {
  767.             thisSprite._state = STATE_RANGED;
  768.             thisSprite._stateDone = false;
  769.             thisSprite._stateChange = false;
  770.             thisSprite.gotoAndPlay("ranged");
  771.             damageDone[spriteIndex][otherIndex] = false;
  772.             thisSprite.projectile._fast = onLeft || onRight;
  773.             if(onLeft && !faceLeft || onRight && faceLeft)
  774.             {
  775.                thisSprite._xscale *= -1;
  776.                faceLeft = !faceLeft;
  777.             }
  778.             if(thisName == NAME_BLOSSOM)
  779.             {
  780.                if(faceLeft)
  781.                {
  782.                   thisSprite._atkdirX = ATKDIR_LEFT;
  783.                }
  784.                else
  785.                {
  786.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  787.                }
  788.                thisSprite._atkdirY = ATKDIR_NONE;
  789.                thisSprite._damage = 5;
  790.             }
  791.             else if(thisName == NAME_BUBBLES)
  792.             {
  793.                thisSprite._damage = 0;
  794.                thisSprite.projectile._damage = 3;
  795.             }
  796.             else if(thisName == NAME_ROWDY)
  797.             {
  798.                thisSprite._damage = 0;
  799.                thisSprite.projectile._damage = BOOMER_DAMAGE;
  800.             }
  801.             else if(thisName == NAME_BUTTERCUP)
  802.             {
  803.                if(faceLeft)
  804.                {
  805.                   thisSprite._atkdirX = ATKDIR_LEFT;
  806.                }
  807.                else
  808.                {
  809.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  810.                }
  811.                thisSprite._atkdirY = ATKDIR_NONE;
  812.                thisSprite._damage = 6;
  813.             }
  814.             else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  815.             {
  816.                if(faceLeft)
  817.                {
  818.                   thisSprite._atkdirX = ATKDIR_LEFT;
  819.                }
  820.                else
  821.                {
  822.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  823.                }
  824.                thisSprite._atkdirY = ATKDIR_NONE;
  825.                thisSprite._damage = 6;
  826.             }
  827.             else if(thisName == NAME_DEXTER)
  828.             {
  829.                if(faceLeft)
  830.                {
  831.                   thisSprite._atkdirX = ATKDIR_LEFT;
  832.                }
  833.                else
  834.                {
  835.                   thisSprite._atkdirX = ATKDIR_RIGHT;
  836.                }
  837.                thisSprite._atkdirY = ATKDIR_NONE;
  838.                thisSprite._damage = 6;
  839.             }
  840.          }
  841.       }
  842.       else if(!thisSprite._deflected)
  843.       {
  844.          thisSprite._state = STATE_COMBO1;
  845.          thisSprite._stateDone = false;
  846.          thisSprite.gotoAndPlay("combo1");
  847.          bufferedCombo2[spriteIndex] = false;
  848.          bufferedCombo3[spriteIndex] = false;
  849.          if(thisSprite._yspd < 0)
  850.          {
  851.             thisSprite._yspd = 0;
  852.          }
  853.          damageDone[spriteIndex][otherIndex] = false;
  854.          if(onLeft && !faceLeft || onRight && faceLeft)
  855.          {
  856.             thisSprite._xscale *= -1;
  857.             faceLeft = !faceLeft;
  858.          }
  859.          if(faceLeft)
  860.          {
  861.             thisSprite._atkdirX = ATKDIR_NONELEFT;
  862.          }
  863.          else
  864.          {
  865.             thisSprite._atkdirX = ATKDIR_NONERIGHT;
  866.          }
  867.          thisSprite._atkdirY = ATKDIR_NONE;
  868.          thisSprite._damage = 4;
  869.          if(thisName == NAME_DEXTER)
  870.          {
  871.             thisSprite._damage = 5;
  872.          }
  873.       }
  874.    }
  875.    else if((newA || newB) && !ai && thisSprite._state == STATE_COMBO1)
  876.    {
  877.       if(!bufferedCombo2[spriteIndex])
  878.       {
  879.          if(newA)
  880.          {
  881.             bufferedCombo2[spriteIndex] = KEYINDEX_A;
  882.          }
  883.          else
  884.          {
  885.             bufferedCombo2[spriteIndex] = KEYINDEX_B;
  886.          }
  887.       }
  888.       else if(!bufferedCombo3[spriteIndex])
  889.       {
  890.          if(newA)
  891.          {
  892.             bufferedCombo3[spriteIndex] = KEYINDEX_A;
  893.          }
  894.          else
  895.          {
  896.             bufferedCombo3[spriteIndex] = KEYINDEX_B;
  897.          }
  898.       }
  899.    }
  900.    else if((newA || newB) && !ai && thisSprite._state == STATE_COMBO2)
  901.    {
  902.       if(!bufferedCombo3[spriteIndex])
  903.       {
  904.          if(newA)
  905.          {
  906.             bufferedCombo3[spriteIndex] = KEYINDEX_A;
  907.          }
  908.          else
  909.          {
  910.             bufferedCombo3[spriteIndex] = KEYINDEX_B;
  911.          }
  912.       }
  913.    }
  914.    else if((onLeft || onRight) && (thisName != NAME_ZIM || thisSprite._dashes > 2))
  915.    {
  916.       if(thisName != NAME_ZIM || _numPlayers == 1 || thisName == NAME_ZIM && _numPlayers > 1 && (thisSprite._dashes > 200 || thisSprite._state == STATE_RUN && thisSprite._dashes > 2))
  917.       {
  918.          if(onLeft && onRight)
  919.          {
  920.             onRight = false;
  921.          }
  922.          if(thisSprite._state == STATE_IDLE)
  923.          {
  924.             if(!thisSprite._airborne)
  925.             {
  926.                thisSprite.gotoAndPlay("forward");
  927.             }
  928.             thisSprite._state = STATE_RUN;
  929.          }
  930.          if(thisSprite._state == STATE_RUN)
  931.          {
  932.             if(thisName == NAME_ZIM && _numPlayers > 1)
  933.             {
  934.                thisSprite._dashes -= 6;
  935.             }
  936.             if(onLeft && !faceLeft || onRight && faceLeft)
  937.             {
  938.                thisSprite._xscale *= -1;
  939.                faceLeft = !faceLeft;
  940.             }
  941.          }
  942.       }
  943.    }
  944.    else if(thisSprite._state == STATE_RUN)
  945.    {
  946.       if(!thisSprite._airborne)
  947.       {
  948.          thisSprite.gotoAndPlay("idle");
  949.       }
  950.       thisSprite._state = STATE_IDLE;
  951.    }
  952.    if(thisSprite._state == STATE_SHIELD)
  953.    {
  954.       if(onLeft && !faceLeft || onRight && faceLeft)
  955.       {
  956.          thisSprite._xscale *= -1;
  957.          faceLeft = !faceLeft;
  958.       }
  959.    }
  960.    if(thisSprite._state == STATE_IDLE || thisSprite._state == STATE_RUN)
  961.    {
  962.       if(newUp && thisSprite._yspd == 0 && !thisSprite._airborne && !thisSprite._jumpDelay && thisName != NAME_ZIM)
  963.       {
  964.          thisSprite._yspd = - SPRITE_JUMPSPEED[thisName];
  965.          thisSprite.gotoAndPlay("jump");
  966.          thisSprite._airborne = true;
  967.       }
  968.       else if(newUp && thisSprite._yspd != 0 && !thisSprite._doubleJumped && thisSprite._airborne)
  969.       {
  970.          thisSprite._yspd = - SPRITE_JUMPSPEED[thisName] + 5;
  971.          thisSprite.gotoAndPlay("teleport");
  972.          thisSprite._doubleJumped = true;
  973.          clearKeyCombo(spriteIndex);
  974.       }
  975.       else if(!onUp && thisSprite._yspd < 0)
  976.       {
  977.          thisSprite._yspd = 0;
  978.          thisSprite.gotoAndPlay("fall");
  979.       }
  980.    }
  981.    thisSprite._xspd = 0;
  982.    if(thisSprite._state == STATE_DASH)
  983.    {
  984.       if(thisSprite._dashFuel > 0)
  985.       {
  986.          if(onB)
  987.          {
  988.             if(faceLeft)
  989.             {
  990.                thisSprite._xspd += - SPRITE_RUNSPEED[thisName];
  991.             }
  992.             else
  993.             {
  994.                thisSprite._xspd += SPRITE_RUNSPEED[thisName];
  995.             }
  996.          }
  997.          else if(faceLeft)
  998.          {
  999.             thisSprite._xspd += (- SPRITE_RUNSPEED[thisName]) * 2;
  1000.          }
  1001.          else
  1002.          {
  1003.             thisSprite._xspd += SPRITE_RUNSPEED[thisName] * 2;
  1004.          }
  1005.          thisSprite._dashFuel--;
  1006.       }
  1007.       else
  1008.       {
  1009.          thisSprite._state = STATE_RUN;
  1010.          if(!thisSprite._airborne)
  1011.          {
  1012.             thisSprite.gotoAndPlay("forward");
  1013.          }
  1014.          else
  1015.          {
  1016.             thisSprite.gotoAndPlay("fall");
  1017.          }
  1018.       }
  1019.    }
  1020.    else if(thisSprite._state == STATE_RUN)
  1021.    {
  1022.       if(faceLeft)
  1023.       {
  1024.          thisSprite._xspd += - SPRITE_RUNSPEED[thisName];
  1025.       }
  1026.       else
  1027.       {
  1028.          thisSprite._xspd += SPRITE_RUNSPEED[thisName];
  1029.       }
  1030.    }
  1031.    thisSprite._yspd = thisSprite._yspd + 1;
  1032.    if(thisSprite._yspd == 0)
  1033.    {
  1034.       thisSprite._yspd = 1;
  1035.    }
  1036.    if(thisSprite._yspd > SPRITE_MAXFALLSPEED[thisName])
  1037.    {
  1038.       thisSprite._yspd = SPRITE_MAXFALLSPEED[thisName];
  1039.    }
  1040.    if(thisSprite._state == STATE_DASH)
  1041.    {
  1042.       thisSprite._yspd = 0;
  1043.    }
  1044.    else if(thisSprite._state == STATE_COMBO2B)
  1045.    {
  1046.       if(thisName == NAME_BLOSSOM)
  1047.       {
  1048.          if(thisSprite._stateChange)
  1049.          {
  1050.             thisSprite._stateChange = false;
  1051.             thisSprite._yspd = -16;
  1052.             thisSprite._airborne = true;
  1053.          }
  1054.          if(thisSprite._airborne)
  1055.          {
  1056.             if(faceLeft)
  1057.             {
  1058.                thisSprite._xspd -= 5;
  1059.             }
  1060.             else
  1061.             {
  1062.                thisSprite._xspd += 5;
  1063.             }
  1064.          }
  1065.       }
  1066.       else if(thisName == NAME_BUBBLES)
  1067.       {
  1068.          if(thisSprite._stateChange)
  1069.          {
  1070.             thisSprite._stateChange = false;
  1071.             thisSprite._yspd = -15;
  1072.             thisSprite._airborne = true;
  1073.          }
  1074.          if(thisSprite._airborne)
  1075.          {
  1076.             if(faceLeft)
  1077.             {
  1078.                thisSprite._xspd -= 5;
  1079.             }
  1080.             else
  1081.             {
  1082.                thisSprite._xspd += 5;
  1083.             }
  1084.          }
  1085.       }
  1086.       else if(thisName == NAME_BUTTERCUP)
  1087.       {
  1088.          if(faceLeft)
  1089.          {
  1090.             thisSprite._xspd -= 1;
  1091.          }
  1092.          else
  1093.          {
  1094.             thisSprite._xspd += 1;
  1095.          }
  1096.          if(thisSprite._stateChange)
  1097.          {
  1098.             thisSprite._stateChange = false;
  1099.             thisSprite._yspd = -12;
  1100.             thisSprite._airborne = true;
  1101.          }
  1102.       }
  1103.    }
  1104.    else if(thisSprite._state == STATE_COMBO3B)
  1105.    {
  1106.       if(thisName == NAME_BLOSSOM)
  1107.       {
  1108.          if(thisSprite._stateChange)
  1109.          {
  1110.             thisSprite._stateChange = false;
  1111.             thisSprite._yspd = -10;
  1112.             thisSprite._airborne = true;
  1113.          }
  1114.          if(thisSprite._airborne)
  1115.          {
  1116.             if(faceLeft)
  1117.             {
  1118.                thisSprite._xspd -= 15;
  1119.             }
  1120.             else
  1121.             {
  1122.                thisSprite._xspd += 15;
  1123.             }
  1124.          }
  1125.       }
  1126.       else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  1127.       {
  1128.          if(faceLeft)
  1129.          {
  1130.             thisSprite._xspd -= 3;
  1131.          }
  1132.          else
  1133.          {
  1134.             thisSprite._xspd += 3;
  1135.          }
  1136.          if(thisSprite._stateChange)
  1137.          {
  1138.             thisSprite._stateChange = false;
  1139.             thisSprite._yspd = -10;
  1140.             if(thisName == NAME_SHIRABELL)
  1141.             {
  1142.                thisSprite._yspd = -5;
  1143.             }
  1144.             thisSprite._airborne = true;
  1145.          }
  1146.       }
  1147.       else if(thisName == NAME_ROWDY)
  1148.       {
  1149.          if(thisSprite._stateChange)
  1150.          {
  1151.             thisSprite._stateChange = false;
  1152.             thisSprite._yspd = -6;
  1153.             if(thisSprite._damage <= 1)
  1154.             {
  1155.                thisSprite._damage = thisSprite._damage + 1;
  1156.             }
  1157.             else
  1158.             {
  1159.                thisSprite._atkdirY = ATKDIR_JUGGLE;
  1160.             }
  1161.             thisSprite._airborne = true;
  1162.          }
  1163.          if(thisSprite._airborne)
  1164.          {
  1165.             if(faceLeft)
  1166.             {
  1167.                thisSprite._xspd -= 1;
  1168.             }
  1169.             else
  1170.             {
  1171.                thisSprite._xspd += 1;
  1172.             }
  1173.          }
  1174.       }
  1175.    }
  1176.    else if(thisSprite._state == STATE_COMBO3)
  1177.    {
  1178.       if(thisName == NAME_BUTTERCUP)
  1179.       {
  1180.          if(faceLeft)
  1181.          {
  1182.             thisSprite._xspd -= 15;
  1183.          }
  1184.          else
  1185.          {
  1186.             thisSprite._xspd += 15;
  1187.          }
  1188.          if(thisSprite._airborne)
  1189.          {
  1190.             thisSprite._yspd = 0;
  1191.          }
  1192.       }
  1193.       else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  1194.       {
  1195.          if(faceLeft)
  1196.          {
  1197.             thisSprite._xspd -= 1;
  1198.          }
  1199.          else
  1200.          {
  1201.             thisSprite._xspd += 1;
  1202.          }
  1203.          if(thisSprite._weakhit)
  1204.          {
  1205.             thisSprite._yspd = -1;
  1206.             thisSprite._airborne = true;
  1207.          }
  1208.       }
  1209.       else if(thisName == NAME_DEXTER)
  1210.       {
  1211.          if(thisSprite._stateChange)
  1212.          {
  1213.             thisSprite._stateChange = false;
  1214.             if(faceLeft)
  1215.             {
  1216.                thisSprite._xspd -= 16;
  1217.             }
  1218.             else
  1219.             {
  1220.                thisSprite._xspd += 16;
  1221.             }
  1222.          }
  1223.       }
  1224.       else if(thisName == NAME_ROWDY)
  1225.       {
  1226.          if(thisSprite._stateChange)
  1227.          {
  1228.             thisSprite._stateChange = false;
  1229.             if(faceLeft)
  1230.             {
  1231.                thisSprite._xspd -= 8;
  1232.             }
  1233.             else
  1234.             {
  1235.                thisSprite._xspd += 8;
  1236.             }
  1237.          }
  1238.       }
  1239.    }
  1240.    else if(thisSprite._state == STATE_DOWNATK)
  1241.    {
  1242.       thisSprite._yspd = 1;
  1243.    }
  1244.    else if(thisSprite._state == STATE_RANGED)
  1245.    {
  1246.       if(thisName == NAME_DEXTER)
  1247.       {
  1248.          if(thisSprite._stateChange)
  1249.          {
  1250.             thisSprite._stateChange = false;
  1251.             if(thisSprite._atkdirX == ATKDIR_RIGHT)
  1252.             {
  1253.                thisSprite._atkdirX = ATKDIR_LEFT;
  1254.             }
  1255.             else
  1256.             {
  1257.                thisSprite._atkdirX = ATKDIR_RIGHT;
  1258.             }
  1259.          }
  1260.       }
  1261.    }
  1262.    else if(thisSprite._state == STATE_AIRRANGED)
  1263.    {
  1264.       if(thisName == NAME_BLOSSOM)
  1265.       {
  1266.          thisSprite._yspd = 2;
  1267.          if(faceLeft)
  1268.          {
  1269.             thisSprite._xspd = thisSprite._xspd + 1;
  1270.          }
  1271.          else
  1272.          {
  1273.             thisSprite._xspd--;
  1274.          }
  1275.       }
  1276.       else if(thisName == NAME_BUBBLES)
  1277.       {
  1278.          thisSprite._yspd = 2;
  1279.          if(faceLeft)
  1280.          {
  1281.             thisSprite._xspd = thisSprite._xspd + 1;
  1282.          }
  1283.          else
  1284.          {
  1285.             thisSprite._xspd--;
  1286.          }
  1287.       }
  1288.       else if(thisName == NAME_BUTTERCUP)
  1289.       {
  1290.          thisSprite._yspd = 1;
  1291.          if(thisSprite._stateChange)
  1292.          {
  1293.             if(faceLeft)
  1294.             {
  1295.                thisSprite._xspd -= 14;
  1296.             }
  1297.             else
  1298.             {
  1299.                thisSprite._xspd += 14;
  1300.             }
  1301.          }
  1302.          else if(faceLeft)
  1303.          {
  1304.             thisSprite._xspd += 5;
  1305.          }
  1306.          else
  1307.          {
  1308.             thisSprite._xspd -= 5;
  1309.          }
  1310.       }
  1311.       else if(thisName == NAME_BELL || thisName == NAME_SHIRABELL)
  1312.       {
  1313.          if(thisSprite._dashFuel <= 0)
  1314.          {
  1315.             thisSprite._yspd = 12;
  1316.             if(faceLeft)
  1317.             {
  1318.                thisSprite._xspd -= 12;
  1319.             }
  1320.             else
  1321.             {
  1322.                thisSprite._xspd += 12;
  1323.             }
  1324.          }
  1325.          else
  1326.          {
  1327.             thisSprite._yspd = 0;
  1328.             thisSprite._dashFuel--;
  1329.          }
  1330.       }
  1331.       else if(thisName == NAME_DEXTER)
  1332.       {
  1333.          if(thisSprite._yspd < -5)
  1334.          {
  1335.             thisSprite._yspd = -5;
  1336.          }
  1337.       }
  1338.    }
  1339.    if(thisSprite._x + thisSprite._xspd < 10)
  1340.    {
  1341.       thisSprite._xspd = 10 - thisSprite._x;
  1342.    }
  1343.    if(thisSprite._x + thisSprite._xspd > 390)
  1344.    {
  1345.       thisSprite._xspd = 390 - thisSprite._x;
  1346.    }
  1347.    if(thisSprite._state == STATE_SHIELDDAMAGE)
  1348.    {
  1349.       if(thisSprite._atkdirX != ATKDIR_VACUUM)
  1350.       {
  1351.          if(thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || thisSprite._atkdirX == ATKDIR_BACK && !faceLeft)
  1352.          {
  1353.             thisSprite._xspd += -1;
  1354.          }
  1355.          else
  1356.          {
  1357.             thisSprite._xspd += 1;
  1358.          }
  1359.       }
  1360.       if(thisSprite._airborne)
  1361.       {
  1362.          if(thisSprite._yspd > 2)
  1363.          {
  1364.             thisSprite._yspd = 2;
  1365.          }
  1366.       }
  1367.    }
  1368.    else if(thisSprite._state == STATE_DAMAGE)
  1369.    {
  1370.       if(thisSprite._atkdirX == ATKDIR_VACUUM)
  1371.       {
  1372.          if(thisSprite._x != sprite[1 - spriteIndex]._x)
  1373.          {
  1374.             if(thisSprite._x > sprite[1 - spriteIndex]._x)
  1375.             {
  1376.                thisSprite._xspd += -1;
  1377.             }
  1378.             else
  1379.             {
  1380.                thisSprite._xspd += 1;
  1381.             }
  1382.          }
  1383.       }
  1384.       else if(thisSprite._atkdirX == ATKDIR_NONELEFT)
  1385.       {
  1386.          thisSprite._xspd += -1;
  1387.       }
  1388.       else if(thisSprite._atkdirX == ATKDIR_NONERIGHT)
  1389.       {
  1390.          thisSprite._xspd += 1;
  1391.       }
  1392.       else if((thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_BACK) && thisSprite._dashFuel > 0)
  1393.       {
  1394.          if(thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_BACK && !faceLeft)
  1395.          {
  1396.             thisSprite._xspd += - Math.round(thisSprite._dashFuel);
  1397.          }
  1398.          else
  1399.          {
  1400.             thisSprite._xspd += Math.round(thisSprite._dashFuel);
  1401.          }
  1402.          if(!thisSprite._airborne)
  1403.          {
  1404.             thisSprite._dashFuel--;
  1405.          }
  1406.          else
  1407.          {
  1408.             thisSprite._dashFuel -= 0.3;
  1409.          }
  1410.       }
  1411.    }
  1412.    thisSprite._yspd += tempyspd;
  1413.    wasAirborne = thisSprite._airborne;
  1414.    collision(thisSprite);
  1415.    if(!thisSprite._airborne)
  1416.    {
  1417.       if(wasAirborne)
  1418.       {
  1419.          if(thisSprite._state == STATE_IDLE)
  1420.          {
  1421.             thisSprite.gotoAndPlay("idle");
  1422.          }
  1423.          else if(thisSprite._state == STATE_RUN)
  1424.          {
  1425.             thisSprite.gotoAndPlay("forward");
  1426.          }
  1427.          thisSprite._doubleJumped = false;
  1428.          thisSprite._jumpDelay = MAX_JUMPDELAY;
  1429.       }
  1430.       if(thisSprite._jumpDelay > 0)
  1431.       {
  1432.          thisSprite._jumpDelay--;
  1433.       }
  1434.       thisSprite._dashed = false;
  1435.       thisSprite._hovered = false;
  1436.    }
  1437.    if(thisSprite._state == STATE_SHIELDDAMAGE)
  1438.    {
  1439.       if(thisSprite._stateDone)
  1440.       {
  1441.          thisSprite._state = STATE_SHIELD;
  1442.       }
  1443.    }
  1444.    else if(thisSprite._state == STATE_DAMAGE)
  1445.    {
  1446.       if(!thisSprite._airborne)
  1447.       {
  1448.          thisSprite._invincible = true;
  1449.       }
  1450.       if((thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_BACK) && thisSprite._dashFuel > 0)
  1451.       {
  1452.          if(!thisSprite._airborne)
  1453.          {
  1454.             thisSprite.gotoAndPlay("fallen");
  1455.             thisSprite._stateDone = true;
  1456.          }
  1457.       }
  1458.       else if(thisSprite._stateDone && !thisSprite._airborne)
  1459.       {
  1460.          thisSprite._state = STATE_FALLEN;
  1461.          thisSprite._fallTime = MAX_FALLTIME;
  1462.          thisSprite.gotoAndPlay("fallen");
  1463.       }
  1464.    }
  1465.    if(thisSprite._state == STATE_IDLE || thisSprite._state == STATE_RUN)
  1466.    {
  1467.       if(thisSprite._yspd == 1 && thisSprite._airborne)
  1468.       {
  1469.          thisSprite.gotoAndPlay("fall");
  1470.       }
  1471.    }
  1472.    else if(thisSprite._state == STATE_WALL)
  1473.    {
  1474.       if(thisSprite._yspd == 1 && thisSprite._airborne)
  1475.       {
  1476.          thisSprite._state = STATE_RUN;
  1477.          thisSprite.gotoAndPlay("fall");
  1478.       }
  1479.    }
  1480.    thisSprite._x += thisSprite._xspd;
  1481.    thisSprite._y += thisSprite._yspd;
  1482.    thisSprite._yspd -= tempyspd;
  1483.    if(tempyspd < 0 && thisSprite._yspd > 0)
  1484.    {
  1485.       thisSprite._yspd = 0;
  1486.    }
  1487.    tempyspd = 0;
  1488.    if(thisSprite._hitDone)
  1489.    {
  1490.       thisSprite._hitDone = false;
  1491.       damageDone[spriteIndex][otherIndex] = false;
  1492.    }
  1493.    if(thisSprite.projectile._visible)
  1494.    {
  1495.       if(thisName == NAME_BUBBLES)
  1496.       {
  1497.          if(thisSprite.projectile._xscale > 0)
  1498.          {
  1499.             thisSprite.projectile._x -= 5;
  1500.             if(thisSprite.projectile._fast)
  1501.             {
  1502.                thisSprite.projectile._x -= 5;
  1503.             }
  1504.          }
  1505.          else
  1506.          {
  1507.             thisSprite.projectile._x += 5;
  1508.             if(thisSprite.projectile._fast)
  1509.             {
  1510.                thisSprite.projectile._x += 5;
  1511.             }
  1512.          }
  1513.       }
  1514.       else if(thisName == NAME_ROWDY && thisSprite.projectile._damage == BOOMER_DAMAGE)
  1515.       {
  1516.          if(thisSprite.projectile._xscale > 0)
  1517.          {
  1518.             thisSprite.projectile._x -= 12;
  1519.          }
  1520.          else
  1521.          {
  1522.             thisSprite.projectile._x += 12;
  1523.          }
  1524.       }
  1525.       if(thisName == NAME_BUBBLES)
  1526.       {
  1527.          thisSprite.projectile._y += thisSprite.projectile._yspd;
  1528.       }
  1529.       if((thisSprite.projectile._x < -20 || thisSprite.projectile._x > 420 || thisSprite.projectile._y > 250) && !thisSprite.projectile._hitDone)
  1530.       {
  1531.          if(thisName != NAME_ROWDY)
  1532.          {
  1533.             thisSprite.projectile.gotoAndPlay("subside");
  1534.          }
  1535.       }
  1536.    }
  1537.    if(_autodeflect)
  1538.    {
  1539.       if(thisSprite._state == STATE_IDLE && !ai)
  1540.       {
  1541.          thisSprite._deflect = true;
  1542.       }
  1543.       if(otherSprite._state == STATE_IDLE && !otherai)
  1544.       {
  1545.          otherSprite._deflect = true;
  1546.       }
  1547.    }
  1548.    if(otherName == NAME_ZIM && !otherSprite._vulnerable)
  1549.    {
  1550.       otherSprite._y -= ZIM_Y_OFFSET;
  1551.    }
  1552.    if(!(otherName == NAME_ZIM && otherSprite._state == STATE_RUN))
  1553.    {
  1554.       if(!((thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_AIRRANGED && thisSprite._dashFuel > 0))
  1555.       {
  1556.          if(thisSprite.atk || !thisSprite.projectile._hitDone || thisName == NAME_ZIM)
  1557.          {
  1558.             if(!thisSprite.projectile._hitDone && !otherSprite._invincible || thisName == NAME_ZIM)
  1559.             {
  1560.                if(thisSprite.projectile.atk.hitTest(otherSprite._x,otherSprite._y,true) && otherSprite._juggles < MAX_COMBO && thisName != NAME_ZIM || thisName == NAME_ZIM && thisSprite.zim.hitTest(otherSprite._x,otherSprite._y,false) && !thisSprite._vulnerable && otherSprite._state != STATE_DAMAGE && otherSprite._state != STATE_DASH)
  1561.                {
  1562.                   if(thisName == NAME_BUBBLES)
  1563.                   {
  1564.                      thisSprite.projectile._x = otherSprite._x;
  1565.                      thisSprite.projectile._y = otherSprite._y;
  1566.                      thisSprite.projectile.gotoAndPlay("subside");
  1567.                   }
  1568.                   dmg = Math.round(thisSprite.projectile._damage * BASE_DAMAGE / 5);
  1569.                   if(otherSprite._deflect)
  1570.                   {
  1571.                      dmg = 0;
  1572.                   }
  1573.                   if(otherSprite._hp - dmg > MIN_HP && thisName != NAME_ZIM && ((otherSprite._state == STATE_SHIELD || otherSprite._state == STATE_SHIELDDAMAGE || otherSprite._deflect) && (otherSprite._xscale > 0 && thisSprite.projectile._xscale < 0 || otherSprite._xscale < 0 && thisSprite.projectile._xscale > 0) || otherai && (otherSprite._state == STATE_IDLE || otherSprite._state == STATE_RUN) && prob(otherSprite._ai_shield)))
  1574.                   {
  1575.                      if(!(otherSprite._xscale > 0 && thisSprite.projectile._xscale < 0 || otherSprite._xscale < 0 && thisSprite.projectile._xscale > 0))
  1576.                      {
  1577.                         otherSprite._xscale *= -1;
  1578.                      }
  1579.                      if(otherSprite._deflect)
  1580.                      {
  1581.                         if(otherSprite._yspd < -5)
  1582.                         {
  1583.                            otherSprite._yspd = -5;
  1584.                         }
  1585.                         otherSprite._state = STATE_SHIELD;
  1586.                         otherSprite.gotoAndPlay("shield");
  1587.                         otherSprite.combo.gotoAndPlay("deflected");
  1588.                         otherSprite._deflected = true;
  1589.                         otherSprite.combo._visible = true;
  1590.                         gotoAndPlay(2023);
  1591.                      }
  1592.                      else
  1593.                      {
  1594.                         otherSprite._state = STATE_SHIELDDAMAGE;
  1595.                         otherSprite.gotoAndPlay("shielddamage");
  1596.                         if(otherSprite._yspd < -5)
  1597.                         {
  1598.                            otherSprite._yspd = -5;
  1599.                         }
  1600.                         otherSprite._stateDone = false;
  1601.                         if(thisSprite.projectile._xscale > 0)
  1602.                         {
  1603.                            otherSprite._atkdirX = ATKDIR_LEFT;
  1604.                         }
  1605.                         else
  1606.                         {
  1607.                            otherSprite._atkdirX = ATKDIR_RIGHT;
  1608.                         }
  1609.                         if(ai)
  1610.                         {
  1611.                            thisSprite._ai_flank += thisSprite._ai_flankspd;
  1612.                         }
  1613.                         otherSprite._hp -= dmg;
  1614.                         if(thisSprite._personality == AI_AGGRESSIVE)
  1615.                         {
  1616.                            thisSprite._aggressiveRating += dmg;
  1617.                         }
  1618.                         else if(thisSprite._personality == AI_RANGED)
  1619.                         {
  1620.                            thisSprite._rangedRating += dmg;
  1621.                         }
  1622.                         if(otherSprite._personality == AI_AGGRESSIVE)
  1623.                         {
  1624.                            otherSprite._aggressiveRating -= dmg;
  1625.                         }
  1626.                         else if(otherSprite._personality == AI_RANGED)
  1627.                         {
  1628.                            otherSprite._rangedRating -= dmg;
  1629.                         }
  1630.                      }
  1631.                   }
  1632.                   else
  1633.                   {
  1634.                      dmg = thisSprite.projectile._damage * BASE_DAMAGE;
  1635.                      if(_gameMode == MODE_TUTORIAL)
  1636.                      {
  1637.                         dmg = 0;
  1638.                      }
  1639.                      if(otherName == NAME_SHIRABELL && (!otherai || _gameMode != MODE_STORY))
  1640.                      {
  1641.                         dmg = Math.round(dmg * 2);
  1642.                      }
  1643.                      else if(otherName == NAME_ZIM)
  1644.                      {
  1645.                         dmg = Math.round(dmg * 0.8);
  1646.                      }
  1647.                      else if(thisName == NAME_ZIM)
  1648.                      {
  1649.                         dmg = Math.round(dmg * (_difficulty / MAX_DIFFICULTY));
  1650.                      }
  1651.                      otherSprite._hp -= dmg;
  1652.                      if(thisSprite._personality == AI_AGGRESSIVE)
  1653.                      {
  1654.                         thisSprite._aggressiveRating += dmg;
  1655.                      }
  1656.                      else if(thisSprite._personality == AI_RANGED)
  1657.                      {
  1658.                         thisSprite._rangedRating += dmg;
  1659.                      }
  1660.                      if(otherSprite._personality == AI_AGGRESSIVE)
  1661.                      {
  1662.                         otherSprite._aggressiveRating -= dmg;
  1663.                      }
  1664.                      else if(otherSprite._personality == AI_RANGED)
  1665.                      {
  1666.                         otherSprite._rangedRating -= dmg;
  1667.                      }
  1668.                      if(otherName != NAME_ZIM)
  1669.                      {
  1670.                         otherSprite.gotoAndPlay("damage");
  1671.                         otherSprite._state = STATE_DAMAGE;
  1672.                         otherSprite._stateDone = false;
  1673.                         otherSprite._yspd = -15;
  1674.                         otherSprite._airborne = true;
  1675.                         if(thisSprite.projectile._xscale > 0)
  1676.                         {
  1677.                            otherSprite._atkdirX = ATKDIR_NONELEFT;
  1678.                         }
  1679.                         else
  1680.                         {
  1681.                            otherSprite._atkdirX = ATKDIR_NONERIGHT;
  1682.                         }
  1683.                         if(thisName == NAME_ROWDY)
  1684.                         {
  1685.                            otherSprite._yspd = -10;
  1686.                            if(thisSprite.projectile._xscale > 0)
  1687.                            {
  1688.                               otherSprite._atkdirX = ATKDIR_LEFT;
  1689.                            }
  1690.                            else
  1691.                            {
  1692.                               otherSprite._atkdirX = ATKDIR_RIGHT;
  1693.                            }
  1694.                            if(thisSprite.projectile._damage == BUTCH_DAMAGE)
  1695.                            {
  1696.                               otherSprite._yspd = -3;
  1697.                               if(thisSprite.projectile._xscale > 0)
  1698.                               {
  1699.                                  otherSprite._atkdirX = ATKDIR_NONELEFT;
  1700.                               }
  1701.                               else
  1702.                               {
  1703.                                  otherSprite._atkdirX = ATKDIR_NONERIGHT;
  1704.                               }
  1705.                            }
  1706.                         }
  1707.                         if(thisName == NAME_ZIM)
  1708.                         {
  1709.                            otherSprite._yspd = -5;
  1710.                            if(thisSprite._state == STATE_RUN)
  1711.                            {
  1712.                               if(!faceLeft)
  1713.                               {
  1714.                                  otherSprite._atkdirX = ATKDIR_LEFT;
  1715.                               }
  1716.                               else
  1717.                               {
  1718.                                  otherSprite._atkdirX = ATKDIR_RIGHT;
  1719.                               }
  1720.                            }
  1721.                            else if(faceLeft)
  1722.                            {
  1723.                               otherSprite._atkdirX = ATKDIR_LEFT;
  1724.                            }
  1725.                            else
  1726.                            {
  1727.                               otherSprite._atkdirX = ATKDIR_RIGHT;
  1728.                            }
  1729.                         }
  1730.                         otherSprite._atkdirY = ATKDIR_NONE;
  1731.                         if(thisName != NAME_ROWDY)
  1732.                         {
  1733.                            otherSprite._juggles += 0.8;
  1734.                         }
  1735.                         otherSprite._dashFuel = 15;
  1736.                      }
  1737.                      else if(otherSprite._recover)
  1738.                      {
  1739.                         otherSprite._hp += dmg;
  1740.                      }
  1741.                      else
  1742.                      {
  1743.                         otherSprite.zim.gotoAndPlay("damaged");
  1744.                      }
  1745.                      if(!otherSprite._recover)
  1746.                      {
  1747.                         effectHit[effectHitCounter]._x = otherSprite._x;
  1748.                         effectHit[effectHitCounter]._y = otherSprite._y;
  1749.                         effectHit[effectHitCounter]._rotation = Math.random() * 360;
  1750.                         effectHit[effectHitCounter].gotoAndPlay(1);
  1751.                         effectHit[effectHitCounter]._visible = true;
  1752.                         effectHitCounter = (effectHitCounter + 1) % MAX_HITEFFECTS;
  1753.                         thisSprite.combo.num = thisSprite.combo.num + 1;
  1754.                         if(thisSprite.combo.num > 1)
  1755.                         {
  1756.                            thisSprite.combo.gotoAndPlay(1);
  1757.                            thisSprite.combo._visible = true;
  1758.                         }
  1759.                      }
  1760.                   }
  1761.                }
  1762.                else if(thisSprite.projectile._visible && otherSprite.projectile._visible && !thisSprite.projectile._hitDone && !otherSprite.projectile._hitDone && thisSprite.projectile.atk.hitTest(otherSprite.projectile))
  1763.                {
  1764.                   if(thisName == NAME_BUBBLES && otherName == NAME_BUBBLES)
  1765.                   {
  1766.                      thisSprite.projectile.gotoAndPlay("subside");
  1767.                      otherSprite.projectile.gotoAndPlay("subside");
  1768.                   }
  1769.                }
  1770.             }
  1771.             if(!otherSprite._invincible && !damageDone[spriteIndex][otherIndex] && (thisSprite.atk.hitTest(otherSprite._x,otherSprite._y,true) || otherName == NAME_ZIM && !otherSprite._vulnerable && thisSprite._airborne && thisSprite.atk.hitTest(otherSprite._x,otherSprite._y + ZIM_Y_OFFSET2,true)) && otherSprite._juggles < MAX_COMBO)
  1772.             {
  1773.                dmg = Math.round(thisSprite._damage * BASE_DAMAGE / 5);
  1774.                if(otherSprite._deflect)
  1775.                {
  1776.                   dmg = 0;
  1777.                }
  1778.                if(otherSprite._hp - dmg > MIN_HP && ((otherSprite._state == STATE_SHIELD || otherSprite._state == STATE_SHIELDDAMAGE || otherSprite._deflect) && (otherSprite._xscale > 0 && (thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_NONERIGHT || otherSprite._x >= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM) || otherSprite._xscale < 0 && (thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || otherSprite._x <= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM)) || otherai && (otherSprite._state == STATE_IDLE || otherSprite._state == STATE_RUN) && prob(otherSprite._ai_shield)))
  1779.                {
  1780.                   if(!(otherSprite._xscale > 0 && (thisSprite._atkdirX == ATKDIR_RIGHT || thisSprite._atkdirX == ATKDIR_NONERIGHT || otherSprite._x >= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM) || otherSprite._xscale < 0 && (thisSprite._atkdirX == ATKDIR_LEFT || thisSprite._atkdirX == ATKDIR_NONELEFT || otherSprite._x <= thisSprite._x && thisSprite._atkdirX == ATKDIR_VACUUM)))
  1781.                   {
  1782.                      otherSprite._xscale *= -1;
  1783.                   }
  1784.                   if(otherSprite._deflect)
  1785.                   {
  1786.                      if(otherSprite._yspd < -5)
  1787.                      {
  1788.                         otherSprite._yspd = -5;
  1789.                      }
  1790.                      otherSprite._state = STATE_SHIELD;
  1791.                      otherSprite.gotoAndPlay("shield");
  1792.                      otherSprite.combo.gotoAndPlay("deflected");
  1793.                      otherSprite._deflected = true;
  1794.                      otherSprite.combo._visible = true;
  1795.                      gotoAndPlay(2023);
  1796.                   }
  1797.                   else
  1798.                   {
  1799.                      otherSprite._state = STATE_SHIELDDAMAGE;
  1800.                      otherSprite.gotoAndPlay("shielddamage");
  1801.                      if(otherSprite._yspd < -5)
  1802.                      {
  1803.                         otherSprite._yspd = -5;
  1804.                      }
  1805.                      otherSprite._stateDone = false;
  1806.                      otherSprite._atkdirX = thisSprite._atkdirX;
  1807.                      if(ai)
  1808.                      {
  1809.                         thisSprite._ai_flank += thisSprite._ai_flankspd;
  1810.                      }
  1811.                      if(thisSprite._state == STATE_COMBO1 || thisSprite._state == STATE_COMBO2)
  1812.                      {
  1813.                         dmg = 0;
  1814.                      }
  1815.                      otherSprite._hp -= dmg;
  1816.                      if(thisSprite._personality == AI_AGGRESSIVE)
  1817.                      {
  1818.                         thisSprite._aggressiveRating += dmg;
  1819.                      }
  1820.                      else if(thisSprite._personality == AI_RANGED)
  1821.                      {
  1822.                         thisSprite._rangedRating += dmg;
  1823.                      }
  1824.                      if(otherSprite._personality == AI_AGGRESSIVE)
  1825.                      {
  1826.                         otherSprite._aggressiveRating -= dmg;
  1827.                      }
  1828.                      else if(otherSprite._personality == AI_RANGED)
  1829.                      {
  1830.                         otherSprite._rangedRating -= dmg;
  1831.                      }
  1832.                   }
  1833.                }
  1834.                else if(otherSprite._hp - thisSprite._damage * BASE_DAMAGE > MIN_HP && (thisName == NAME_BLOSSOM && (thisSprite._state == STATE_RANGED || thisSprite._state == STATE_AIRRANGED)))
  1835.                {
  1836.                   if(otherSprite._state != STATE_FROZEN && otherName != NAME_ZIM)
  1837.                   {
  1838.                      otherSprite.gotoAndPlay("frozen");
  1839.                      otherSprite._state = STATE_FROZEN;
  1840.                      otherSprite._stateDone = false;
  1841.                      if(otherSprite._yspd < -5)
  1842.                      {
  1843.                         otherSprite._yspd = -5;
  1844.                      }
  1845.                      dmg = thisSprite._damage * BASE_DAMAGE;
  1846.                      if(_gameMode == MODE_TUTORIAL)
  1847.                      {
  1848.                         dmg = 0;
  1849.                      }
  1850.                      otherSprite._hp -= dmg;
  1851.                      if(thisSprite._personality == AI_AGGRESSIVE)
  1852.                      {
  1853.                         thisSprite._aggressiveRating += dmg;
  1854.                      }
  1855.                      else if(thisSprite._personality == AI_RANGED)
  1856.                      {
  1857.                         thisSprite._rangedRating += dmg;
  1858.                      }
  1859.                      if(otherSprite._personality == AI_AGGRESSIVE)
  1860.                      {
  1861.                         otherSprite._aggressiveRating -= dmg;
  1862.                      }
  1863.                      else if(otherSprite._personality == AI_RANGED)
  1864.                      {
  1865.                         otherSprite._rangedRating -= dmg;
  1866.                      }
  1867.                      otherSprite._atkdirX = thisSprite._atkdirX;
  1868.                      otherSprite._atkdirY = thisSprite._atkdirY;
  1869.                      if(otherSprite._yspd > -5)
  1870.                      {
  1871.                         otherSprite._yspd = -5;
  1872.                      }
  1873.                      otherSprite._airborne = true;
  1874.                      otherSprite._dashFuel = 15;
  1875.                      thisSprite.combo.num = thisSprite.combo.num + 1;
  1876.                      if(thisSprite.combo.num > 1)
  1877.                      {
  1878.                         thisSprite.combo.gotoAndPlay(1);
  1879.                         thisSprite.combo._visible = true;
  1880.                      }
  1881.                   }
  1882.                }
  1883.                else
  1884.                {
  1885.                   if(otherName != NAME_ZIM)
  1886.                   {
  1887.                      otherSprite.gotoAndPlay("damage");
  1888.                      otherSprite._state = STATE_DAMAGE;
  1889.                      otherSprite._stateDone = false;
  1890.                      if(otherSprite._yspd < -5 && thisSprite._atkdirY != ATKDIR_BOUNCE)
  1891.                      {
  1892.                         otherSprite._yspd = -5;
  1893.                      }
  1894.                      if(thisSprite._weakHit)
  1895.                      {
  1896.                         if(thisSprite._state != STATE_AIRRANGED)
  1897.                         {
  1898.                            if(thisName == NAME_BUTTERCUP && (thisSprite._state == STATE_COMBO3B || thisSprite._state == STATE_RANGED) || (thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_RANGED)
  1899.                            {
  1900.                               otherSprite._atkdirX = thisSprite._atkdirX;
  1901.                            }
  1902.                            else if(thisSprite._atkdirX == ATKDIR_LEFT)
  1903.                            {
  1904.                               otherSprite._atkdirX = ATKDIR_NONELEFT;
  1905.                            }
  1906.                            else if(thisSprite._atkdirX == ATKDIR_RIGHT)
  1907.                            {
  1908.                               otherSprite._atkdirX = ATKDIR_NONERIGHT;
  1909.                            }
  1910.                            else
  1911.                            {
  1912.                               otherSprite._atkdirX = thisSprite._atkdirX;
  1913.                            }
  1914.                         }
  1915.                         else
  1916.                         {
  1917.                            otherSprite._atkdirX = thisSprite._atkdirX;
  1918.                         }
  1919.                         otherSprite._atkdirY = thisSprite._atkdirY;
  1920.                         if((thisName == NAME_BELL || thisName == NAME_SHIRABELL) && thisSprite._state == STATE_COMBO3)
  1921.                         {
  1922.                            otherSprite._atkdirY = ATKDIR_NONE;
  1923.                         }
  1924.                         otherSprite._airborne = true;
  1925.                         if(thisName == NAME_BUTTERCUP && thisSprite._state == STATE_COMBO2)
  1926.                         {
  1927.                            otherSprite._juggles += 0.8;
  1928.                         }
  1929.                      }
  1930.                      else
  1931.                      {
  1932.                         otherSprite._atkdirX = thisSprite._atkdirX;
  1933.                         otherSprite._atkdirY = thisSprite._atkdirY;
  1934.                         otherSprite._juggles = otherSprite._juggles + 1;
  1935.                      }
  1936.                      if(otherSprite._atkdirY == ATKDIR_JUGGLE)
  1937.                      {
  1938.                         if(otherSprite._yspd > -20)
  1939.                         {
  1940.                            otherSprite._yspd = -20;
  1941.                         }
  1942.                         otherSprite._airborne = true;
  1943.                      }
  1944.                      else if(otherSprite._atkdirY == ATKDIR_UP)
  1945.                      {
  1946.                         if(otherSprite._yspd > -15)
  1947.                         {
  1948.                            otherSprite._yspd = -15;
  1949.                         }
  1950.                         otherSprite._airborne = true;
  1951.                      }
  1952.                      else if(otherSprite._atkdirY == ATKDIR_BOUNCE)
  1953.                      {
  1954.                         if(otherSprite._y < 60)
  1955.                         {
  1956.                            if(otherSprite._yspd > -11 + otherSprite._y / 12)
  1957.                            {
  1958.                               otherSprite._yspd = Math.floor(-11 + otherSprite._y / 12);
  1959.                            }
  1960.                         }
  1961.                         else if(otherSprite._yspd > -11)
  1962.                         {
  1963.                            otherSprite._yspd = -11;
  1964.                         }
  1965.                         otherSprite._airborne = true;
  1966.                      }
  1967.                      else if(otherSprite._atkdirY == ATKDIR_DOWN)
  1968.                      {
  1969.                         if(otherSprite._y < 180)
  1970.                         {
  1971.                            if(otherSprite._yspd > 0)
  1972.                            {
  1973.                               otherSprite._yspd = 0;
  1974.                            }
  1975.                         }
  1976.                         else if(otherSprite._yspd > -3)
  1977.                         {
  1978.                            otherSprite._yspd = -3;
  1979.                         }
  1980.                         otherSprite._airborne = true;
  1981.                      }
  1982.                      else if(otherSprite._atkdirY == ATKDIR_NONE)
  1983.                      {
  1984.                         if(otherSprite._yspd > -5)
  1985.                         {
  1986.                            otherSprite._yspd = -5;
  1987.                         }
  1988.                         otherSprite._airborne = true;
  1989.                      }
  1990.                      otherSprite._dashFuel = 15;
  1991.                   }
  1992.                   else if(otherSprite._recover)
  1993.                   {
  1994.                      otherSprite._hp += dmg;
  1995.                   }
  1996.                   else
  1997.                   {
  1998.                      otherSprite.zim.gotoAndPlay("damaged");
  1999.                      if(thisSprite._state == STATE_DOWNATK)
  2000.                      {
  2001.                         otherSprite._armour--;
  2002.                      }
  2003.                   }
  2004.                   if(!otherSprite._recover)
  2005.                   {
  2006.                      effectHit[effectHitCounter]._x = otherSprite._x;
  2007.                      effectHit[effectHitCounter]._y = otherSprite._y;
  2008.                      effectHit[effectHitCounter]._rotation = Math.random() * 360;
  2009.                      effectHit[effectHitCounter].gotoAndPlay(1);
  2010.                      effectHit[effectHitCounter]._visible = true;
  2011.                      effectHitCounter = (effectHitCounter + 1) % MAX_HITEFFECTS;
  2012.                      thisSprite.combo.num = thisSprite.combo.num + 1;
  2013.                      if(thisSprite.combo.num > 1)
  2014.                      {
  2015.                         thisSprite.combo.gotoAndPlay(1);
  2016.                         thisSprite.combo._visible = true;
  2017.                      }
  2018.                   }
  2019.                   dmg = thisSprite._damage * BASE_DAMAGE;
  2020.                   if(_gameMode == MODE_TUTORIAL)
  2021.                   {
  2022.                      dmg = 0;
  2023.                   }
  2024.                   if(otherName == NAME_SHIRABELL && (!otherai || _gameMode != MODE_STORY))
  2025.                   {
  2026.                      dmg = Math.round(dmg * 2);
  2027.                   }
  2028.                   else if(otherName == NAME_ZIM)
  2029.                   {
  2030.                      dmg = Math.round(dmg * 0.8);
  2031.                   }
  2032.                   else if(thisName == NAME_ZIM)
  2033.                   {
  2034.                      dmg = Math.round(dmg * (_difficulty / MAX_DIFFICULTY));
  2035.                   }
  2036.                   otherSprite._hp -= dmg;
  2037.                   if(thisSprite._personality == AI_AGGRESSIVE)
  2038.                   {
  2039.                      thisSprite._aggressiveRating += dmg;
  2040.                   }
  2041.                   else if(thisSprite._personality == AI_RANGED)
  2042.                   {
  2043.                      thisSprite._rangedRating += dmg;
  2044.                   }
  2045.                   if(otherSprite._personality == AI_AGGRESSIVE)
  2046.                   {
  2047.                      otherSprite._aggressiveRating -= dmg;
  2048.                   }
  2049.                   else if(otherSprite._personality == AI_RANGED)
  2050.                   {
  2051.                      otherSprite._rangedRating -= dmg;
  2052.                   }
  2053.                }
  2054.                damageDone[spriteIndex][otherIndex] = true;
  2055.             }
  2056.             if(!otherSprite.projectile._hitDone && otherSprite.projectile._visible && thisSprite.atk.hitTest(otherSprite.projectile._x,otherSprite.projectile._y,true) && (thisSprite._state == STATE_RANGED || (thisSprite._state == STATE_COMBO3B && thisName == NAME_BUTTERCUP)(thisSprite._state == STATE_COMBO3 && (thisName == NAME_BLOSSOM || thisName == NAME_BUBBLES))))
  2057.             {
  2058.                if(otherName == NAME_BUBBLES)
  2059.                {
  2060.                   otherSprite.projectile.gotoAndPlay("subside");
  2061.                }
  2062.             }
  2063.          }
  2064.       }
  2065.    }
  2066.    if(otherName == NAME_ZIM && !otherSprite._vulnerable)
  2067.    {
  2068.       otherSprite._y += ZIM_Y_OFFSET;
  2069.    }
  2070.    if(_autodeflect)
  2071.    {
  2072.       if(thisSprite._state == STATE_IDLE && !ai)
  2073.       {
  2074.          thisSprite._deflect = false;
  2075.          thisSprite._deflected = false;
  2076.          thisSprite._deflectwait = false;
  2077.       }
  2078.       if(otherSprite._state == STATE_IDLE && !otherai)
  2079.       {
  2080.          otherSprite._deflect = false;
  2081.          otherSprite._deflected = false;
  2082.          otherSprite._deflectwait = false;
  2083.       }
  2084.    }
  2085.    spriteIndex++;
  2086. }
  2087. if(_scroll)
  2088. {
  2089.    chgtx = sprite[0]._x - SCREENSIZE_HALFWIDTH;
  2090.    chgty = sprite[0]._y - 50;
  2091.    chgtx = (chgtx + sprite[1]._x - SCREENSIZE_HALFWIDTH) / 2;
  2092.    chgty = Math.min(chgty,sprite[1]._y - 50);
  2093.    if(spriteName[1] == NAME_ZIM)
  2094.    {
  2095.       chgtx = 0;
  2096.    }
  2097.    chgtx = Math.round(chgtx / 3);
  2098.    chgty = Math.round(chgty / 3);
  2099.    if(terrain._x - chgtx > -10)
  2100.    {
  2101.       chgtx = terrain._x + 10;
  2102.    }
  2103.    if(terrain._x - chgtx < -250)
  2104.    {
  2105.       chgtx = terrain._x + 250;
  2106.    }
  2107.    if(terrain._y - chgty < -245)
  2108.    {
  2109.       chgty = terrain._y + 245;
  2110.    }
  2111.    if(terrain._y - chgty > -130)
  2112.    {
  2113.       chgty = terrain._y + 130;
  2114.    }
  2115.    terrain._x -= chgtx;
  2116.    terrain._y -= chgty;
  2117.    fg1._x -= chgtx * 2;
  2118.    fg1._y -= chgty * 2;
  2119.    fg2._x -= chgtx * 2;
  2120.    fg2._y -= chgty * 2;
  2121.    spriteIndex = 0;
  2122.    while(spriteIndex < _spriteInstances)
  2123.    {
  2124.       sprite[spriteIndex]._x -= chgtx;
  2125.       sprite[spriteIndex]._y -= chgty;
  2126.       if(!sprite[spriteIndex].projectile._hitDone)
  2127.       {
  2128.          sprite[spriteIndex].projectile._x -= chgtx;
  2129.          sprite[spriteIndex].projectile._y -= chgty;
  2130.       }
  2131.       spriteIndex++;
  2132.    }
  2133.    opaque._x = terrain._x;
  2134.    opaque._y = terrain._y;
  2135. }
  2136. sprite[0]._hp = Math.max(sprite[0]._hp,MIN_HP);
  2137. sprite[1]._hp = Math.max(sprite[1]._hp,MIN_HP);
  2138. hpbar0.hid._width = 200 - sprite[0]._hp / 5;
  2139. hpbar0.cur._x = 100 + sprite[0]._hp / 10;
  2140. hpbar1.hid._width = 200 - sprite[1]._hp / 5;
  2141. hpbar1.cur._x = 100 + sprite[1]._hp / 10;
  2142. if(sprite[0]._dashes < 300)
  2143. {
  2144.    sprite[0]._dashes = sprite[0]._dashes + 1;
  2145. }
  2146. if(sprite[1]._dashes < 300)
  2147. {
  2148.    sprite[1]._dashes = sprite[1]._dashes + 1;
  2149. }
  2150. dashbarframe0.dashbar._xscale = Math.min(100 - sprite[0]._dashes / 3,100);
  2151. dashbarframe1.dashbar._xscale = Math.min(100 - sprite[1]._dashes / 3,100);
  2152. spriteIndex = 0;
  2153. while(spriteIndex < _spriteInstances)
  2154. {
  2155.    if(sprite[spriteIndex]._invincible && sprite[spriteIndex]._state != STATE_HIT && sprite[spriteIndex]._state != STATE_DAMAGE && sprite[spriteIndex]._state != STATE_DASH && sprite[spriteIndex]._state != STATE_FALLEN && sprite[spriteIndex]._state != STATE_RECOVER)
  2156.    {
  2157.       if(sprite[spriteIndex]._invincibleWait)
  2158.       {
  2159.          sprite[spriteIndex]._invincible = false;
  2160.          sprite[spriteIndex]._invincibleWait = false;
  2161.          thisSprite._juggles = 0;
  2162.       }
  2163.       sprite[spriteIndex]._invincibleWait = true;
  2164.    }
  2165.    if(sprite[spriteIndex]._x < 0)
  2166.    {
  2167.       sprite[spriteIndex]._x = 11;
  2168.    }
  2169.    if(sprite[spriteIndex]._x > 400)
  2170.    {
  2171.       sprite[spriteIndex]._x = 389;
  2172.    }
  2173.    if(sprite[spriteIndex]._y - (terrain._y + 245) > 260)
  2174.    {
  2175.       sprite[spriteIndex]._y = 203;
  2176.    }
  2177.    if(sprite[spriteIndex]._y < -100 && sprite[spriteIndex]._yspd < 0)
  2178.    {
  2179.       sprite[spriteIndex]._yspd = 0;
  2180.       sprite[spriteIndex]._y = 0;
  2181.       trace("Houston, we have a problem.");
  2182.    }
  2183.    spriteIndex++;
  2184. }
  2185. if(sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP)
  2186. {
  2187.    if(!_gameover)
  2188.    {
  2189.       _gameover = true;
  2190.       readyfight.removeMovieClip();
  2191.       winFlash.play();
  2192.       winFlash.colour = new Color(winFlash);
  2193.       effectHit[MAX_HITEFFECTS]._visible = true;
  2194.       if(sprite[0]._hp <= MIN_HP)
  2195.       {
  2196.          sprite[1].combo._finish = true;
  2197.          if(sprite[1].combo.num > 1)
  2198.          {
  2199.             sprite[1].combo.gotoAndPlay(1);
  2200.          }
  2201.          winFlash.colour.setTransform(winClrTrans[spriteName[1]]);
  2202.          effectHit[MAX_HITEFFECTS]._x = sprite[0]._x;
  2203.          effectHit[MAX_HITEFFECTS]._y = sprite[0]._y;
  2204.       }
  2205.       else
  2206.       {
  2207.          sprite[0].combo._finish = true;
  2208.          if(sprite[0].combo.num > 1)
  2209.          {
  2210.             sprite[0].combo.gotoAndPlay(1);
  2211.          }
  2212.          winFlash.colour.setTransform(winClrTrans[spriteName[0]]);
  2213.          effectHit[MAX_HITEFFECTS]._x = sprite[1]._x;
  2214.          effectHit[MAX_HITEFFECTS]._y = sprite[1]._y;
  2215.       }
  2216.       effectHit[MAX_HITEFFECTS]._visible = true;
  2217.       effectHit[MAX_HITEFFECTS].gotoAndPlay(1);
  2218.       gotoAndPlay(2033);
  2219.    }
  2220. }
  2221. if((sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP) && (!sprite[0].projectile._visible && !sprite[1].projectile._visible) && !sprite[0]._airborne && !sprite[1]._airborne && (sprite[0]._state == STATE_IDLE || sprite[1]._state == STATE_IDLE || sprite[0]._state == STATE_RUN || sprite[1]._state == STATE_RUN || sprite[0]._hp <= MIN_HP && sprite[1]._hp <= MIN_HP))
  2222. {
  2223.    if(sprite[0]._hp > MIN_HP)
  2224.    {
  2225.       if(sprite[0]._state == STATE_RUN)
  2226.       {
  2227.          sprite[0].gotoAndPlay("idle");
  2228.       }
  2229.       sprite[0]._state = STATE_IDLE;
  2230.       if(spriteName[0] == NAME_DEXTER)
  2231.       {
  2232.          if(sprite[0]._xscale > 0 && sprite[0]._x < sprite[1]._x || sprite[0]._xscale < 0 && sprite[0]._x > sprite[1]._x)
  2233.          {
  2234.             sprite[0]._xscale *= -1;
  2235.          }
  2236.          if(sprite[0]._xscale > 0 && sprite[0]._x > 360 || sprite[0]._xscale < 0 && sprite[0]._x < 40)
  2237.          {
  2238.             sprite[0]._xscale *= -1;
  2239.          }
  2240.       }
  2241.    }
  2242.    if(sprite[1]._hp > MIN_HP)
  2243.    {
  2244.       if(sprite[1]._state == STATE_RUN)
  2245.       {
  2246.          sprite[1].gotoAndPlay("idle");
  2247.       }
  2248.       sprite[1]._state = STATE_IDLE;
  2249.       if(spriteName[1] == NAME_DEXTER)
  2250.       {
  2251.          if(sprite[1]._xscale > 0 && sprite[1]._x < sprite[0]._x || sprite[1]._xscale < 0 && sprite[1]._x > sprite[0]._x)
  2252.          {
  2253.             sprite[1]._xscale *= -1;
  2254.          }
  2255.          if(sprite[1]._xscale > 0 && sprite[1]._x > 360 || sprite[1]._xscale < 0 && sprite[1]._x < 40)
  2256.          {
  2257.             sprite[1]._xscale *= -1;
  2258.          }
  2259.       }
  2260.    }
  2261.    gotoAndPlay(2037);
  2262. }
  2263. else if(_gameover && (sprite[0]._hp <= MIN_HP || sprite[1]._hp <= MIN_HP))
  2264. {
  2265.    if(winFlash._currentframe != 1)
  2266.    {
  2267.       gotoAndPlay(2018);
  2268.    }
  2269. }
  2270. if(_returntomenu)
  2271. {
  2272.    stopAllSounds();
  2273.    removeAllClips();
  2274.    gotoAndPlay(1226);
  2275. }
  2276. else if(_paused)
  2277. {
  2278.    gotoAndPlay(2015);
  2279. }
  2280. if(sprite[0]._deflected)
  2281. {
  2282.    sprite[0]._aideflected = true;
  2283. }
  2284. if(!sprite[0]._deflect)
  2285. {
  2286.    sprite[0]._deflected = false;
  2287. }
  2288. else if(sprite[0]._deflectwait)
  2289. {
  2290.    sprite[0]._deflectwait = false;
  2291. }
  2292. else
  2293. {
  2294.    sprite[0]._deflect = false;
  2295. }
  2296. if(sprite[1]._deflected)
  2297. {
  2298.    sprite[1]._aideflected = true;
  2299.    sprite[1]._state = STATE_SHIELD;
  2300.    sprite[1].gotoAndPlay("shield");
  2301. }
  2302. if(!sprite[1]._deflect)
  2303. {
  2304.    sprite[1]._deflected = false;
  2305. }
  2306. else if(sprite[1]._deflectwait)
  2307. {
  2308.    sprite[1]._deflectwait = false;
  2309. }
  2310. else
  2311. {
  2312.    sprite[1]._deflect = false;
  2313. }
  2314.